﻿@* --------------------------------------------------------------------------------------------------------------------
// <copyright file="Upload.cshtml" company="Devbridge Group LLC">
// 
// Copyright (C) 2015,2016 Devbridge Group LLC
// 
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// 
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
// 
// You should have received a copy of the GNU Lesser General Public License
// along with this program.  If not, see http://www.gnu.org/licenses/. 
// </copyright>
// 
// <summary>
// Better CMS is a publishing focused and developer friendly .NET open source CMS.
// 
// Website: https://www.bettercms.com 
// GitHub: https://github.com/devbridge/bettercms
// Email: info@bettercms.com
// </summary>
// -------------------------------------------------------------------------------------------------------------------- *@
@model BetterCms.Sandbox.Mvc4.Models.TestUploadViewModel

<h1>Sandbox Upload Tester</h1>

@if (Model != null && Model.Result != null)
{
    @Html.Raw(Model.Result)
}

@using (Html.BeginForm("Upload", "Upload", FormMethod.Post, new { enctype = "multipart/form-data" }))
{
    <span>Select type of uploading file:</span>
    <p>
        <select name="type">
            <option value="">Image</option>
            <option value="file"@(Model != null && Model.Type == "file" ? " selected" : string.Empty)>File</option>
        </select>
    </p>

    <span>Select type of upload method (determines, if response should wait while file is being processed to the storage):</span>
    <p>
        <select name="method">
            <option value="">Asynchronous (do not wait)</option>
            <option value="sync" @(Model != null && Model.Method == "sync" ? " selected" : string.Empty)>Synchronous (wait)</option>
        </select>
    </p>
    <p>
        <input type="file" name="file" />
        <input type="submit" value="upload" />
    </p>
}

